<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue@2.6.10/dist/vue.js"></script>
  </head>

  <body>
    <div id="app">
      <button @click="handler">修改基本类型数据</button>
      <p>数据展示{{msg}}</p>
    </div>
    <script>
      Vue.config.productionTip = false;

      const vm = new Vue({
        el: "#app",
        data() {
          return {
            msg: "hello",
          };
        },
        methods: {
          handler() {
            console.log(this);
            /* 
              如何响应式的修改data数据:
                - 基本类型值直接修改即可(其实是重新赋值),是拥有响应式的
            */
            //    this.msg = '王俊凯'
            this.$data.msg = '王源'
          },
        },
      });
    </script>
  </body>
</html>
